Skip to content

feat: OpenBlog-common 抽取 + 邮箱注册验证码 + 统一通知抽象层/MQ - #16

Merged
yyyCode merged 12 commits into
masterfrom
dev
Aug 27, 2026
Merged

feat: OpenBlog-common 抽取 + 邮箱注册验证码 + 统一通知抽象层/MQ#16
yyyCode merged 12 commits into
masterfrom
dev

Conversation

@yyyCode

@yyyCode yyyCode commented Aug 8, 2026

Copy link
Copy Markdown
Owner

概要

三个阶段的工作合并 dev → master:

  1. OpenBlog-common 模块抽取(10 个提交):ApiResponse / BizException / PageResult / GlobalExceptionHandler / TraceId / TreeUtils 从 business 抽到独立 common 模块,自动装配注册,全局异常处理统一
  2. 邮箱注册验证码82eacc2):验证码前置注册流程 + email 模块 Dubbo 幂等发送(修复 Dubbo 重试导致重复发信的 Bug)
  3. 统一通知抽象层 + MQ 异步投递a392214):Channel 策略 + 模板方法 + 本地消息表(Transactional Outbox)+ RocketMQ Relay/Consumer

变更内容

OpenBlog-common

  • 新增 OpenBlog-common 模块,抽取公共 POJO 与全局异常处理器
  • CommonAutoConfiguration + AutoConfiguration.imports 自动注册

邮箱注册验证码

  • EmailCodeService:生成 / 发送 / 校验验证码(Redis 存码、60s 冷却、5min TTL、错误次数限制)
  • email 模块幂等发送:idempotencyKey + email_records.idempotency_key 唯一索引
  • 修复 EmailValidator '+' 别名检查越界 Bug
  • 前端注册页验证码输入 + 60s 倒计时

统一通知抽象层 + MQ(P1)

  • NotificationChannel 策略 + AbstractNotificationChannel 模板方法 + 模板渲染 + Registry + 门面
  • P1 异步管道:notification_outbox(与业务同事务)+ RocketMQ Relay / Consumer,幂等复用 messageId
  • 同步验证码链路行为不变(Dubbo 直发);submitAsync 为未来异步通知的接入点
  • 单测 14 个(路由 / 渲染 / outbox / Relay / submitAsync)
  • docker/rocketmq/ 部署脚本 + 建表 SQL

验证

  • mvn -pl OpenBlog-business -am clean package 通过
  • 14 个通知单测全绿
  • git merge-tree 检测 master 无冲突(master 已被 dev 历史完全包含)

部署注意

  • 需执行 SQL:sql/migrate-email-records-idempotency-key.sqlsql/notification-outbox.sql
  • 异步链路需先部署 RocketMQ(docker/rocketmq/);验证码同步链路不受影响

🤖 Generated with Claude Code

yyyCode and others added 12 commits August 9, 2026 01:59
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
… from scan

Co-Authored-By: Claude <noreply@anthropic.com>
- @ConditionalOnClass: bean method-level string form, not class-level
- ComponentScan example: add back TypeExcludeFilter/AutoConfigurationExcludeFilter
- ConditionalOnWebApplication: one class-level guard, not two
- remove duplicate '依赖接线' heading

Co-Authored-By: Claude <noreply@anthropic.com>
…cker deploy

Co-Authored-By: Claude <noreply@anthropic.com>
- business 新增 EmailCodeService:生成/发送/校验验证码(Redis 存码、60s 冷却、5 分钟 TTL、错误次数限制)
- 注册接口校验验证码,通过才创建用户;EmailValidator 修复 '+' 别名检查越界
- email 模块幂等发送:idempotencyKey + email_records 唯一索引,防止 Dubbo 默认重试重复发信
- 前端注册页验证码输入 + 60s 倒计时
- 记录 Dubbo 重放问题与幂等设计经验(docs/dev-experiences.md)

Co-Authored-By: Claude <noreply@anthropic.com>
- 通知抽象层:NotificationChannel 策略 + AbstractNotificationChannel 模板方法 + 模板渲染
  + ChannelRegistry 路由 + NotificationService 门面,当前 EMAIL 直发 Dubbo
- P1 异步管道:notification_outbox + RocketMQ Relay/Consumer,幂等复用 messageId
  (outbox 与业务同事务,Relay 至少一次发布,email 模块唯一索引兜底去重)
- EmailCodeService 改经 NotificationService 发信,同步验证码行为与幂等保障不变
- 单测:ChannelRegistry 路由 / 模板渲染 / outbox 映射 / Relay 发布 / submitAsync 幂等键
- RocketMQ docker-compose 部署脚本 + outbox 建表 SQL

Co-Authored-By: Claude <noreply@anthropic.com>
@yyyCode yyyCode changed the title refactor: extract OpenBlog-common module, unify HTTP response format feat: OpenBlog-common 抽取 + 邮箱注册验证码 + 统一通知抽象层/MQ Aug 27, 2026
@yyyCode
yyyCode merged commit d1223cc into master Aug 27, 2026
@yyyCode
yyyCode deleted the dev branch August 27, 2026 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant